﻿'*******************************************************************************************
'* Copyright Brügmann Software GmbH, Papenburg
'* Author: Björn Kremer
'* Contact: codeplex<at>patorg.de
'* 
'* VB.CMIS is a VB.NET implementation of the Content Management Interoperability Services (CMIS) standard
'*
'* This file is part of VB.CMIS.
'* 
'* VB.CMIS is free software: you can redistribute it and/or modify
'* it under the terms of the GNU Lesser General Public License as published by
'* the Free Software Foundation, either version 3 of the License, or
'* (at your option) any later version.
'* 
'* VB.CMIS is distributed in the hope that it will be useful,
'* but WITHOUT ANY WARRANTY; without even the implied warranty of
'* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
'* GNU Lesser General Public License for more details.
'* 
'* You should have received a copy of the GNU Lesser General Public License
'* along with VB.CMIS. If not, see <http://www.gnu.org/licenses/>.
'*******************************************************************************************
Imports System.Xml.Serialization
Namespace CMISObjects
   <XmlRoot("object", Namespace:=CmisNamespaceConstants.Cmisra)>
   Public Class CmisRelationshipObject
      Inherits CMISObject
      Public Property SourceId As String
      Public Property TargetId As String
      Public Sub New()
         MyBase.New()
      End Sub
      Public Sub New(id As String, properties() As CMISObjectModel.Properties.ICMISProperty, SingleTypeId As String, allowableActions As AllowableActions, sourceId As String, targetId As String)
         MyBase.New(id, properties, SingleTypeId, allowableActions)
         Me.SourceId = sourceId
         Me.TargetId = targetId
      End Sub

      Public Overrides Function GetAtomLinks(baseUri As System.Uri, RepositoryInfo As CMISObjectModel.ServiceDocument.RepositoryInfo) As System.Collections.Generic.List(Of CMISLink)
         Dim retVal As List(Of CMISLink) = MyBase.GetAtomLinks(baseUri, RepositoryInfo)
         retVal.Add(New CMISLink(New Uri(baseUri, ServiceURIs.GetObjectBase.Replace("{repositoryId}", RepositoryInfo.RepositoryId).Replace("{id}", Me.Id).TrimStart("/"c)), CmisAtomLinkConstants.Edit, CmisContentTypeConstants.Entry))
         retVal.Add(New CMISLink(New Uri(baseUri, ServiceURIs.GetObjectBase.Replace("{repositoryId}", RepositoryInfo.RepositoryId).Replace("{id}", Me.SourceId).TrimStart("/"c)), CmisAtomLinkConstants.Source, CmisContentTypeConstants.Entry))
         retVal.Add(New CMISLink(New Uri(baseUri, ServiceURIs.GetObjectBase.Replace("{repositoryId}", RepositoryInfo.RepositoryId).Replace("{id}", Me.TargetId).TrimStart("/"c)), CmisAtomLinkConstants.Target, CmisContentTypeConstants.Entry))
         Return retVal
      End Function
   End Class
End Namespace